-
Notifications
You must be signed in to change notification settings - Fork 1
Fsw interface 2 #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fsw interface 2 #56
Conversation
…uses an install error on some systems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates an updated Flight Software interface into the Monte Carlo simulation, extends the physics models (power, gravity, drag, SRP), restructures configuration parameters, and overhauls the visualization pipeline.
- Restructured
params.yamlto centralize simulation and spacecraft parameters with new flags and hardware specs - Introduced power dynamics modules and hooked them into the rigid‐body integrator
- Expanded gravity, drag, and SRP models; refactored and consolidated plotting code while removing obsolete web visualizer files
Reviewed Changes
Copilot reviewed 67 out of 75 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| montecarlo/configs/params.yaml | Restructured and expanded simulation parameters |
| argusim/world/physics/models/power.h | Added power dynamics interface |
| argusim/world/physics/models/power.cpp | Implemented power consumption and generation logic |
| argusim/world/physics/models/gravity.h | Declared sun/moon gravity and gravity‐gradient torque |
| argusim/world/physics/models/gravity.cpp | Implemented sun/moon gravity and gradient torque |
| argusim/world/physics/models/drag.h | Added drag torque interface |
| argusim/world/physics/models/drag.cpp | Implemented drag acceleration and torque |
| argusim/world/physics/models/SRP.h | Simplified shadow function and updated SRP interface |
| argusim/world/physics/models/SRP.cpp | Implemented shadow_factor and SRP acceleration |
| argusim/world/physics/models/MagneticField.cpp | Kept IGRF call; added TODO for IGRF version update |
| argusim/world/physics/models/CMakeLists.txt | Added power.cpp to the models library |
| argusim/world/physics/geometry.py | Added 3D geometry classes for occlusion and lookup table generation |
| argusim/world/physics/RigidBody.h | Updated dynamics signatures to include new models and flags |
| argusim/world/physics/RigidBody.cpp | Integrated power and actuator dynamics, updated RK4 integration |
| argusim/world/math/utils_and_transforms.h | Added SliceDef and quaternion‐conversion declarations |
| argusim/world/math/utils_and_transforms.cpp | Implemented vectorToQuaternion utility |
| argusim/world/init.py | Removed deprecated quaternion imports |
| argusim/world/LUT_generator.py | Added lookup‐table generator for geometry and sensors |
| argusim/visualization/web_visualizer/templates/home_page.html | Removed outdated web UI template |
| argusim/visualization/web_visualizer/templates/compare.html | Removed outdated web UI template |
| argusim/visualization/web_visualizer/static/css/style.css | Removed outdated web CSS |
| argusim/visualization/web_visualizer/job_comparison_tool.py | Removed obsolete comparison tool |
| argusim/visualization/sensor_plots.py | Refactored discrete sensor plotting functions |
| argusim/visualization/plotter/plots.py | Removed legacy plotter and consolidated plotting modules |
| argusim/visualization/plotter/plot_pointing.py | Removed deprecated pointing plots |
| argusim/visualization/plotter/plot_menu.py | Removed obsolete plot‐selection menu |
| argusim/visualization/plotter.py | Refactored main plotting entry‐point |
| argusim/visualization/plots.py | Introduced unified visualization module |
| argusim/visualization/plot_true_states.py | Extracted true‐state plotting helpers |
Comments suppressed due to low confidence (3)
argusim/world/math/utils_and_transforms.h:88
- [nitpick] The
vectorToQuaternionfunction lacks a docstring describing the expected vector format and behavior. Add a docstring to clarify its purpose and input requirements.
Quaternion vectorToQuaternion(const Eigen::VectorXd& vec);
argusim/world/physics/models/drag.cpp:15
- [nitpick] This TODO calls out a hard-coded Earth rotation vector. Either implement a proper source (e.g., SPICE) or clarify in documentation when the approximation is acceptable.
// [TODO]: Get more accurate earth rotation vector
montecarlo/configs/params.yaml:11
- [nitpick] There are multiple
use*flags at the top level; grouping them under a dedicated subsection (e.g., PerturbationFlags) would improve readability and organization.
useSun : False
| normal = np.cross(vector1, vector2) | ||
| return normal / np.linalg.norm(normal) | ||
|
|
||
| def is_intersecting_edge(self, point, direction, Edge): |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The method returns either False or a numpy array, leading to inconsistent return types. Consider returning None for no intersection and an array for intersection to clarify its behavior.
| { // VectorXd resistances, | ||
| // VectorXd power_consumption = control_input(u_idx_map["mtb_volt"].to_seq()).array() * control_input(u_idx_map["mtb_volt"].to_seq()).array() / resistances.array(); |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] There are outdated commented‐out code lines referring to unused variables. Remove or update these comments to keep the implementation clean and accurate.
| { // VectorXd resistances, | |
| // VectorXd power_consumption = control_input(u_idx_map["mtb_volt"].to_seq()).array() * control_input(u_idx_map["mtb_volt"].to_seq()).array() / resistances.array(); | |
| { |
| double mu = 3.98600435507e14; | ||
| double J2 = 1.08262668e-3; | ||
| double R_earth = 6.378137e6; | ||
| double mu_sun = 1.32712440018e20; | ||
| double mu_moon = 4.902801e12; |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Global gravity constants are defined as non‐const variables. Consider marking them as static constexpr or const to avoid multiple definitions and clearly indicate they are immutable constants.
| double mu = 3.98600435507e14; | |
| double J2 = 1.08262668e-3; | |
| double R_earth = 6.378137e6; | |
| double mu_sun = 1.32712440018e20; | |
| double mu_moon = 4.902801e12; | |
| static constexpr double mu = 3.98600435507e14; | |
| static constexpr double J2 = 1.08262668e-3; | |
| static constexpr double R_earth = 6.378137e6; | |
| static constexpr double mu_sun = 1.32712440018e20; | |
| static constexpr double mu_moon = 4.902801e12; |
| if (sd >= 0.0) { | ||
| return 1.0; | ||
| } else if (c < (b - a)) { | ||
| return 0.0; | ||
| } else { | ||
| double x = (c * c + a * a - b * b) / (2 * c); | ||
| double y = sqrt(a * a - x * x); | ||
| double A = a * a * acos(x / a) + b * b * acos((c - x) / b) - c * y; | ||
| double nu = 1 - A / (M_PI * a * a); | ||
| return nu; | ||
| } | ||
| } | ||
|
|
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The early return on sd >= 0.0 may classify shadowed points as fully illuminated. Review the shadow‐factor logic to ensure correct handling of partial or full eclipse conditions.
argusim/world/physics/RigidBody.cpp
Outdated
| VectorXd x_old = x; | ||
| VectorXd mtb_currents = x(SC.x_idx_map["mtb_currents"].to_seq()); | ||
| VectorXd mtb_volt = u(SC.u_idx_map["mtb_volt"].to_seq()); | ||
| x_old(SC.x_idx_map["mtb_currents"].to_seq()) = SC.MTB.getVoltageOrCurrent(mtb_volt, mtb_currents, "first"); |
Copilot
AI
Jul 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The integration stage is selected via string literals like "first"/"half"/"full", which can lead to typos. Consider using an enum or named constants for clarity and safety.
plot fix
Changes: